<template>
	<view class="page">
		<view class="list">
			<view class="list-item">
				<view class="card" v-for="(item,index) in list" :key="index" @tap="to(item)">
					<u-image v-if="" width="100%" height="300rpx" :src="item.image"></u-image>
					<view class="card-bottom flex flex-between">
						<view class="title flex-1">{{item.title}}</view>
						<view class="time">{{item.time}}</view>
					</view>
					<!-- <view class="desc u-line-2">
						{{item.desc}}
					</view> -->
					<view class="dot-wrap" style="position: absolute;bottom: 60rpx;right: 10rpx;">
						<u-badge :isDot="true" type="error " size="large"></u-badge>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		sysList
	} from "@/common/config/chat.js"
	export default {
		data() {
			return {
				list:[],
				page:0,
				total:0,
				
			};
		},
		onShow() {
			this.list=[]
			this.getList()
		},
		onReachBottom() {
			if(this.list.length<this.total){
				this.getList()
			}
		},
		methods:{
			getList(){
				sysList({
					page:this.page
				}).then(res=>{
					console.log(res,'系统公告')
					this.list=[...this.list,...res.data.data.data]
					this.total=res.data.data.total
					if(this.list.length<this.total){
						this.page++
					}else{
						uni.showToast({
							icon:'none',
							title:'没有更多数据了'
						})
					}
				})
			},
			to(item){
				uni.navigateTo({
					url:`/pages/other/other?type=sys&title=${item.title}&detail=${item.detail}&id=${item.id}`
				})
			}
		}
	}
</script>

<style lang="less" scoped>
.page{
	min-height: 100vh;
	background: #F7F7F7;
	overflow: hidden;
}	

.flex{
	display: flex;
	align-items: center;
	&-1{
		flex: 1;
	}
	&-2{
		flex:2
	}
	&-between{
		justify-content: space-between;
	}
}
.card{
	margin: 20rpx;
	background: #fff;
	border-radius: 20rpx;
	overflow: hidden;
	position: relative;
	.card-bottom{
		padding: 30rpx;
		.title{
			font-size: 30rpx;
			margin-right: 10rpx;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}
		.time{
			font-size: 26rpx;
			color: #666666;
		}
	}
	.desc{
		padding: 0 30rpx 30rpx;
	}
}
</style>
